home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume5 / xpclock / part01 next >
Encoding:
Text File  |  1989-11-12  |  23.2 KB  |  850 lines

  1. Path: uunet!island!argv
  2. From: argv@island.uu.net (Dan Heller)
  3. Newsgroups: comp.sources.x
  4. Subject: v05i025: xpclock - pendulum clock , Part01/01
  5. Message-ID: <1186@island.uu.net>
  6. Date: 12 Nov 89 19:30:20 GMT
  7. Organization: Island Graphics, Marin County, California
  8. Lines: 839
  9. Approved: island!argv@sun.com
  10.  
  11. Submitted-by: uunet!kddlab!isl.yamaha.co.jp!shutoh (Kazuhiko Shutoh)
  12. Posting-number: Volume 5, Issue 25
  13. Archive-name: xpclock/part01
  14.  
  15.  
  16.  
  17.  
  18.  
  19. Dear Dan Heller
  20.  
  21.     Hello! Mr. Dan Heller. 
  22.     I am creating xpclock, pendulum clock for X11.
  23.  
  24.     Please examine it for distribute comp.sources.x.
  25.  
  26.  
  27. PS. This program is heavy CPU eater :-) but ok?
  28.  
  29.                 Kazuhiko Shutoh
  30.                 shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net  
  31.  
  32.  
  33. ----- CUT HERE ----- CUT HERE ----- CUT HERE ----- CUT HERE ----- CUT HERE --
  34. #! /bin/sh
  35. # This is a shell archive.  Remove anything before this line, then unpack
  36. # it by saving it into a file and typing "sh file".  To overwrite existing
  37. # files, type "sh file -c".  You can also feed this as standard input via
  38. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  39. # will see the following message at the end:
  40. #        "End of shell archive."
  41. # Contents:  Imakefile Makefile.simple README xpclock.c xpclock.h
  42. #   xpclock.icon xpclock.man
  43. # Wrapped by shutoh@shako on Sat Nov 11 16:54:26 1989
  44. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  45. if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  46.   echo shar: Will not clobber existing file \"'Imakefile'\"
  47. else
  48. echo shar: Extracting \"'Imakefile'\" \(813 characters\)
  49. sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
  50. X#   SCCS ID : @(#)Imakefile    1.5   11/11/89
  51. X#
  52. X#   Imakefile - Imakefile for xpclock
  53. X# 
  54. X#   Author: Kazuhiko Shutoh, 1989.
  55. X#
  56. X#   Permission to use, copy, modify and distribute without charge this
  57. X#   software, documentation, images, etc. is granted, provided that this 
  58. X#   comment and the author's name is retained.  The author assumes no 
  59. X#   responsibility for lost sleep as a consequence of use of this software.
  60. X#
  61. X#   Send any comments, bug reports, etc. to: shutoh@isl.yamaha.co.jp or, 
  62. X#   for oversea: shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net  
  63. X#                              
  64. X
  65. X
  66. X
  67. XLOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  68. XSYS_LIBRARIES = -lm
  69. X
  70. XSRCS = xpclock.c xpclock.h xpclock.icon
  71. XOBJS = xpclock.o
  72. X
  73. X#CC = gcc
  74. XCC = cc
  75. X
  76. X#DEBUGFLAGS = -g
  77. XCDEBUGFLAGS = -O
  78. X
  79. XComplexProgramTarget(xpclock)
  80. X
  81. X
  82. X
  83. END_OF_FILE
  84. if test 813 -ne `wc -c <'Imakefile'`; then
  85.     echo shar: \"'Imakefile'\" unpacked with wrong size!
  86. fi
  87. # end of 'Imakefile'
  88. fi
  89. if test -f 'Makefile.simple' -a "${1}" != "-c" ; then 
  90.   echo shar: Will not clobber existing file \"'Makefile.simple'\"
  91. else
  92. echo shar: Extracting \"'Makefile.simple'\" \(868 characters\)
  93. sed "s/^X//" >'Makefile.simple' <<'END_OF_FILE'
  94. X#   SCCS ID : @(#)Makefile.simple    1.3   11/1/89
  95. X#
  96. X#   Makefile.simple - Simple Makefile for xpclock
  97. X# 
  98. X#   Author: Kazuhiko Shutoh, 1989.
  99. X#
  100. X#   Permission to use, copy, modify and distribute without charge this
  101. X#   software, documentation, images, etc. is granted, provided that this 
  102. X#   comment and the author's name is retained.  The author assumes no 
  103. X#   responsibility for lost sleep as a consequence of use of this software.
  104. X#
  105. X#   Send any comments, bug reports, etc. to: shutoh@isl.yamaha.co.jp or, 
  106. X#   for oversea: shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net  
  107. X#                              
  108. X
  109. X#
  110. X#      Libraries for X11R2
  111. X#
  112. X#LIBS          = -lXaw -lXt -lX11 -lm
  113. X#
  114. X#      Libraries for X11R3
  115. X#
  116. XLIBS           = -lXaw -lXmu -lXt -lX11 -lm
  117. X
  118. Xxpclock: xpclock.o
  119. X    cc -o xpclock xpclock.o $(LIBS)
  120. X
  121. Xxpclock.o: xpclock.c xpclock.h xpclock.icon
  122. X    cc -c xpclock.c 
  123. X
  124. X
  125. X
  126. X
  127. END_OF_FILE
  128. if test 868 -ne `wc -c <'Makefile.simple'`; then
  129.     echo shar: \"'Makefile.simple'\" unpacked with wrong size!
  130. fi
  131. # end of 'Makefile.simple'
  132. fi
  133. if test -f 'README' -a "${1}" != "-c" ; then 
  134.   echo shar: Will not clobber existing file \"'README'\"
  135. else
  136. echo shar: Extracting \"'README'\" \(1080 characters\)
  137. sed "s/^X//" >'README' <<'END_OF_FILE'
  138. XSCCS ID : @(#)README    1.1 11/11/89
  139. X
  140. X
  141. X        Xpclock - Pendulum clock for X11
  142. X
  143. X
  144. X
  145. XTo Install:
  146. X
  147. X    if you have imake, make Makefile from Imakefile and just type, "make".
  148. X    or, simply type "make -f Makefile.simple"
  149. X    or, manual compile "cc -o xpclock xpclock.c -lXaw -lXmu -lXt -lX11 -lm"
  150. X
  151. XXpclock worked on:
  152. X
  153. X    SUN      SUN 3 Series
  154. X        SUN 3/60 + X640 X terminal
  155. X        SUN 4 Series
  156. X
  157. X    SONY     NEWS 3800 Series (R3000 RISC NEWS)
  158. X             NEWS 83* 84* (17**)
  159. X
  160. X    ?     Sequent Symmetry + NCD16 X terminal 
  161. X
  162. X    DEC     DECStation 3100
  163. X        VAX 8350 Ultrix V2.3
  164. X
  165. X    OMRON     LUNA UNIOS-U(System V)
  166. X
  167. X
  168. XCopyright notice and Author:
  169. X
  170. X    Author: Kazuhiko Shutoh, 1989.
  171. X
  172. X    Permission to use, copy, modify and distribute without charge this
  173. X    software, documentation, images, etc. is granted, provided that this 
  174. X    comment and the author's name is retained.  The author assumes no 
  175. X    responsibility for lost sleep as a consequence of use of this software.
  176. X
  177. X    Send any comments, bug reports, etc. to: shutoh@isl.yamaha.co.jp or, 
  178. X    for oversea: shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net  
  179. X        
  180. X
  181. Xenjoy!!!
  182. X                            Kazuhiko Shutoh       
  183. X
  184. X
  185. X    
  186. END_OF_FILE
  187. if test 1080 -ne `wc -c <'README'`; then
  188.     echo shar: \"'README'\" unpacked with wrong size!
  189. fi
  190. # end of 'README'
  191. fi
  192. if test -f 'xpclock.c' -a "${1}" != "-c" ; then 
  193.   echo shar: Will not clobber existing file \"'xpclock.c'\"
  194. else
  195. echo shar: Extracting \"'xpclock.c'\" \(9763 characters\)
  196. sed "s/^X//" >'xpclock.c' <<'END_OF_FILE'
  197. Xstatic char     sccsid[] = "@(#)xpclock.c    1.7   11/1/89";
  198. X/*
  199. X * xpclock.c - Pendulum Clock for X11
  200. X * 
  201. X * Author: Kazuhiko Shutoh, 1989.
  202. X * 
  203. X * Permission to use, copy, modify and distribute without charge this software,
  204. X * documentation, images, etc. is granted, provided that this comment and the
  205. X * author's name is retained.  The author assumes no responsibility for lost
  206. X * sleep as a consequence of use of this software.
  207. X * 
  208. X * Send any comments, bug reports, etc. to: shutoh@isl.yamaha.co.jp or, for
  209. X * oversea: shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net
  210. X * 
  211. X */
  212. X
  213. X#include <X11/Xos.h>
  214. X#include <X11/Intrinsic.h>
  215. X#include <X11/StringDefs.h>
  216. X#include <X11/Shell.h>
  217. X#include <X11/Form.h>
  218. X#include <X11/Box.h>
  219. X#include <X11/Clock.h>
  220. X
  221. X#include <stdio.h>
  222. X#include <math.h>
  223. X
  224. X#include "xpclock.h"
  225. X#include "xpclock.icon"
  226. X
  227. XXtTimerCallbackProc MovePendulum();
  228. XXtCallbackProc  RedrawPendulum();
  229. Xvoid            DrawPendulum();
  230. XXtTimerCallbackProc DrawClockFace();
  231. Xvoid            DrawClockArc();
  232. Xvoid            ParseCommandLine();
  233. Xvoid            Usage();
  234. X
  235. XWidget          toplevel, base, pclock, clock, pendulum;
  236. XXPoint          points[37];
  237. XGC              gcPendulum;
  238. XGC              gcClockface;
  239. X
  240. Xint             pendulum_width, pendulum_height;
  241. Xint             pendulum_x = 0, pendulum_y = 0;
  242. Xdouble          pendulum_theta = 0;
  243. Xint             pendulum_vector = 2;
  244. Xlong            pendulum_update;
  245. Xunsigned char   pendulum_flag;
  246. X
  247. Xmain(argc, argv)
  248. X    int             argc;
  249. X    char          **argv;
  250. X{
  251. X
  252. X    Arg             args[10];
  253. X    Cardinal        i;
  254. X    XtTranslations  newTranslations;
  255. X    static XtActionsRec redrawActions[] = {
  256. X        {"expose", (XtCallbackProc) RedrawPendulum},
  257. X    {"resize", (XtCallbackProc) RedrawPendulum}};
  258. X
  259. X    static char    *overrideTranslations =
  260. X    "<Expose>:      expose() \n\
  261. X         <ResReq>:      expose()";
  262. X    XGCValues       gcv;
  263. X
  264. X    toplevel = XtInitialize("xpclock", "XPclock", options, XtNumber(options), &argc, argv);
  265. X
  266. X    /* Parse command line     */
  267. X
  268. X    ParseCommandLine(argc, argv);
  269. X
  270. X    i = 0;
  271. X    XtSetArg(args[0], XtNiconPixmap,
  272. X         XCreateBitmapFromData(XtDisplay(toplevel),
  273. X                XtScreen(toplevel)->root, xpclock_icon_bits,
  274. X                  xpclock_icon_width, xpclock_icon_height));
  275. X    i++;
  276. X    XtSetValues(toplevel, args, i);
  277. X
  278. X    base = XtCreateManagedWidget("base", formWidgetClass,
  279. X                     toplevel, NULL, 0);
  280. X
  281. X    i = 0;
  282. X    XtSetArg(args[i], XtNborderWidth, 2); i++;
  283. X    pclock = XtCreateManagedWidget("pclock", formWidgetClass,
  284. X                       base, args, i);
  285. X
  286. X    i = 0;
  287. X    XtSetArg(args[i], XtNheight, 100); i++;
  288. X    XtSetArg(args[i], XtNwidth, 100); i++;
  289. X    XtSetArg(args[i], XtNborderWidth, 0); i++;
  290. X    clock = XtCreateManagedWidget("clock", clockWidgetClass,
  291. X                      pclock, args, i);
  292. X
  293. X    /* Get GC for clock face */
  294. X
  295. X    XtSetArg(args[0], XtNforeground, 0);
  296. X    XtGetValues(clock, args, 1);
  297. X
  298. X    gcv.foreground = args[0].value;
  299. X    gcClockface = XtGetGC(clock, GCForeground, &gcv);
  300. X
  301. X    XtSetArg(args[0], XtNbackground, 0);
  302. X    XtGetValues(clock, args, 1);
  303. X    args[0].name = "foreground";
  304. X    XtSetValues(clock, args, 1);
  305. X
  306. X    if (pendulum_flag == ON) {
  307. X
  308. X        i = 0;
  309. X        XtSetArg(args[i], XtNheight, 100); i++;
  310. X        XtSetArg(args[i], XtNwidth, 100); i++;
  311. X        XtSetArg(args[i], XtNfromVert, clock); i++;
  312. X        pendulum = XtCreateManagedWidget("meter", boxWidgetClass,
  313. X                        pclock, args, i);
  314. X
  315. X        /* Get GC for Pendulum */
  316. X
  317. X        XtSetArg(args[0], XtNbackground, 0);
  318. X        XtSetArg(args[1], XtNborderColor, 0);
  319. X        XtGetValues(pendulum, args, 2);
  320. X
  321. X        gcv.foreground = args[0].value;
  322. X        gcv.background = args[0].value;
  323. X        gcv.function = GXinvert;
  324. X        gcPendulum = XtGetGC(pendulum, GCFunction, &gcv);
  325. X
  326. X    }
  327. X
  328. X    /* Override Expose / Resize Translation table */
  329. X
  330. X    XtAddActions(redrawActions, XtNumber(redrawActions));
  331. X    newTranslations = XtParseTranslationTable(overrideTranslations);
  332. X    if (pendulum_flag == ON)
  333. X        XtOverrideTranslations(pendulum, newTranslations);
  334. X    XtOverrideTranslations(clock, newTranslations);
  335. X
  336. X    /* Interval timer start     */
  337. X
  338. X    if (pendulum_flag == ON)
  339. X        XtAddTimeOut(pendulum_update, MovePendulum, NULL);
  340. X    XtAddTimeOut(CLOCKFACE_UPDATE, DrawClockFace, NULL);
  341. X
  342. X    XtRealizeWidget(toplevel);
  343. X    XtMainLoop();
  344. X
  345. X}
  346. X
  347. XXtTimerCallbackProc
  348. XMovePendulum(client_data, id)
  349. X    caddr_t         client_data;
  350. X    XtIntervalId    id;
  351. X{
  352. X
  353. X
  354. X    Arg             args[10];
  355. X    static double   old_pendulum_theta;
  356. X    static int      old_pendulum_x = 0;
  357. X    static int      old_pendulum_y = 0;
  358. X
  359. X    if ((pendulum_x != 0) && (pendulum_y != 0)) {
  360. X        old_pendulum_theta = pendulum_theta;
  361. X        old_pendulum_x = pendulum_x;
  362. X        old_pendulum_y = pendulum_y;
  363. X    }
  364. X    if ((pendulum_theta + pendulum_vector < 0) ||
  365. X        (pendulum_theta + pendulum_vector > 45))
  366. X        pendulum_vector = -pendulum_vector;
  367. X
  368. X    pendulum_theta += (double) pendulum_vector;
  369. X
  370. X    XtSetArg(args[0], XtNheight, 0);
  371. X    XtSetArg(args[1], XtNwidth, 0);
  372. X    XtGetValues(pendulum, args, 2);
  373. X
  374. X    pendulum_height = args[0].value;
  375. X    pendulum_width = args[1].value;
  376. X
  377. X    pendulum_x = (int) (sin((pendulum_theta - 22.5) * PI / 180.0)
  378. X               * pendulum_width * 0.7) + (pendulum_width / 2);
  379. X    pendulum_y = (int) (cos((pendulum_theta - 22.5) * PI / 180.0)
  380. X               * pendulum_height * 0.7);
  381. X
  382. X    DrawPendulum(pendulum_x, pendulum_y, pendulum_theta);
  383. X
  384. X    if ((old_pendulum_x != 0) && (old_pendulum_y != 0))
  385. X        DrawPendulum(old_pendulum_x, old_pendulum_y, old_pendulum_theta);
  386. X
  387. X    XtAddTimeOut(pendulum_update, MovePendulum, NULL);
  388. X
  389. X}
  390. X
  391. X
  392. XXtCallbackProc
  393. XRedrawPendulum(w, event, params, nparams)
  394. X    Widget          w;
  395. X    XEvent         *event;
  396. X    String         *params;
  397. X    Cardinal       *nparams;
  398. X{
  399. X
  400. X    caddr_t         dummy;
  401. X    XtIntervalId    dummy_id;
  402. X
  403. X    if (pendulum_flag == ON) {
  404. X        XClearWindow(XtDisplay(pendulum), XtWindow(pendulum));
  405. X        DrawPendulum(pendulum_x, pendulum_y, pendulum_theta);
  406. X    }
  407. X
  408. X    DrawClockArc();
  409. X    DrawClockFace(dummy, dummy_id);
  410. X
  411. X}
  412. X
  413. X
  414. Xvoid
  415. XDrawPendulum(offset_x, offset_y, theta)
  416. X    int             offset_x;
  417. X    int             offset_y;
  418. X    double          theta;
  419. X{
  420. X    register double angle;
  421. X    register double rsize;
  422. X    register int    count;
  423. X    register int    pendulum_size;
  424. X    int             arm_x, arm_y;
  425. X    register int    shade_count;
  426. X
  427. X    pendulum_size = (pendulum_width < pendulum_height) ? pendulum_width : pendulum_height;
  428. X
  429. X    /*     Pendulum         */
  430. X
  431. X    for (angle = 0, count = 0; angle <= 360; angle += 10, count++) {
  432. X        points[count].x = (short) (sin(angle * PI / 180.0)
  433. X              * (double) (pendulum_size * 0.15) + (double) offset_x);
  434. X        points[count].y = (short) (cos(angle * PI / 180.0)
  435. X              * (double) (pendulum_size * 0.15) + (double) offset_y);
  436. X    }
  437. X
  438. X    XDrawLines(XtDisplay(pendulum), XtWindow(pendulum), gcPendulum,
  439. X           points, count, CoordModeOrigin);
  440. X
  441. X    /*    Shade        */
  442. X
  443. X    for (rsize = 0.04, shade_count = 0; shade_count < 3; shade_count++, rsize += 0.03) {
  444. X        for (angle = 0, count = 0; angle < 80; angle += 10, count++) {
  445. X            points[count].x = (short) (sin(angle * PI / 180.0)
  446. X             * (double) (pendulum_size * rsize) + (double) offset_x);
  447. X            points[count].y = (short) (cos(angle * PI / 180.0)
  448. X             * (double) (pendulum_size * rsize) + (double) offset_y);
  449. X        }
  450. X        XDrawLines(XtDisplay(pendulum), XtWindow(pendulum), gcPendulum,
  451. X               points, count, CoordModeOrigin);
  452. X    }
  453. X
  454. X    /*     Arm     */
  455. X
  456. X    arm_x = (short) (sin((157.5 + theta) * PI / 180.0)
  457. X             * (double) (pendulum_size * 0.15) + (double) offset_x);
  458. X    arm_y = (short) (cos((157.5 + theta) * PI / 180.0)
  459. X             * (double) (pendulum_size * 0.15) + (double) offset_y);
  460. X
  461. X    XDrawLine(XtDisplay(pendulum), XtWindow(pendulum), gcPendulum,
  462. X          pendulum_width / 2, 0, arm_x, arm_y);
  463. X
  464. X}
  465. X
  466. X
  467. XXtTimerCallbackProc
  468. XDrawClockFace(client_data, id)
  469. X    caddr_t         client_data;
  470. X    XtIntervalId    id;
  471. X{
  472. X
  473. X    Arg             args[10];
  474. X    double          angle;
  475. X    int             segment_count;
  476. X    int             clock_height, clock_width;
  477. X    int             number_count;
  478. X    int             number_x, number_y;
  479. X    int             number_height, number_width;
  480. X
  481. X
  482. X    XtSetArg(args[0], XtNheight, 0);
  483. X    XtSetArg(args[1], XtNwidth, 0);
  484. X    XtGetValues(clock, args, 2);
  485. X    clock_height = args[0].value;
  486. X    clock_width = args[1].value;
  487. X    number_height = clock_height * 0.04;
  488. X    number_width = clock_width * 0.04;
  489. X
  490. X    for (angle = 150, number_count = 0; angle >= -180
  491. X         ; angle -= 30, number_count++) {
  492. X        number_x = sin(angle * PI / 180.0)
  493. X            * (clock_width / 2) * 0.8 + (clock_width / 2);
  494. X        number_y = cos(angle * PI / 180.0) * (clock_height / 2)
  495. X            * 0.8 + (clock_height / 2);
  496. X
  497. X        for (segment_count = 0; segment_count < 5; segment_count++) {
  498. X            XDrawLine(XtDisplay(clock), XtWindow(clock), gcClockface,
  499. X                  number_x + (int) ((num_segments[number_count].segment[segment_count].x1) * number_width) - number_width,
  500. X                  number_y + (int) ((num_segments[number_count].segment[segment_count].y1) * number_height) - number_height,
  501. X                  number_x + (int) ((num_segments[number_count].segment[segment_count].x2) * number_width) - number_width,
  502. X                  number_y + (int) ((num_segments[number_count].segment[segment_count].y2) * number_height) - number_height);
  503. X        }
  504. X    }
  505. X
  506. X    XtAddTimeOut(CLOCKFACE_UPDATE, DrawClockFace, NULL);
  507. X
  508. X}
  509. X
  510. Xvoid
  511. XDrawClockArc()
  512. X{
  513. X
  514. X    Arg             args[10];
  515. X    int             clock_height, clock_width;
  516. X
  517. X    XtSetArg(args[0], XtNheight, 0);
  518. X    XtSetArg(args[1], XtNwidth, 0);
  519. X    XtGetValues(clock, args, 2);
  520. X    clock_height = args[0].value;
  521. X    clock_width = args[1].value;
  522. X
  523. X    XDrawArc(XtDisplay(clock), XtWindow(clock), gcClockface, 0, 0, clock_width - 1, clock_height - 1, 0, 23040);
  524. X
  525. X}
  526. X
  527. X
  528. X
  529. Xvoid
  530. XParseCommandLine(ac, av)
  531. X    int             ac;
  532. X    char          **av;
  533. X{
  534. X
  535. X    int             count;
  536. X
  537. X    /* Setup default         */
  538. X
  539. X    pendulum_flag = ON;
  540. X    pendulum_update = 100;
  541. X
  542. X    if (ac > 1)
  543. X        for (count = 1; count < ac; count++) {
  544. X            if ((strcmp("-pupdate", av[count]) == 0)
  545. X                && (count + 1 <= ac))
  546. X                pendulum_update = atol(av[++count]);
  547. X            else if ((strcmp("-nopendulum", av[count]) == 0)
  548. X                 && (count + 1 <= ac)) {
  549. X                pendulum_flag = OFF;
  550. X                count++;
  551. X            } else
  552. X                Usage();
  553. X        }
  554. X}
  555. X
  556. X
  557. Xvoid
  558. XUsage()
  559. X{
  560. X
  561. X    fprintf(stderr, "xpclock <Toolkit Options> [-pupdate millisecond] [-nopendulum]\n");
  562. X
  563. X    exit(-1);
  564. X
  565. X}
  566. END_OF_FILE
  567. if test 9763 -ne `wc -c <'xpclock.c'`; then
  568.     echo shar: \"'xpclock.c'\" unpacked with wrong size!
  569. fi
  570. # end of 'xpclock.c'
  571. fi
  572. if test -f 'xpclock.h' -a "${1}" != "-c" ; then 
  573.   echo shar: Will not clobber existing file \"'xpclock.h'\"
  574. else
  575. echo shar: Extracting \"'xpclock.h'\" \(2714 characters\)
  576. sed "s/^X//" >'xpclock.h' <<'END_OF_FILE'
  577. X/*
  578. X * SCCS ID : @(#)xpclock.h    1.2   11/1/89
  579. X * 
  580. X * xpclock.h - Header for Pendulum Clock for X11
  581. X * 
  582. X * Author: Kazuhiko Shutoh, 1989.
  583. X * 
  584. X * Permission to use, copy, modify and distribute without charge this software,
  585. X * documentation, images, etc. is granted, provided that this comment and the
  586. X * author's name is retained.  The author assumes no responsibility for lost
  587. X * sleep as a consequence of use of this software.
  588. X * 
  589. X * Send any comments, bug reports, etc. to: shutoh@isl.yamaha.co.jp or, for
  590. X * oversea: shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net
  591. X * 
  592. X */
  593. X
  594. X#define        PI        3.141592654
  595. X
  596. X#define        ON        1
  597. X#define        OFF        0
  598. X
  599. X#define        CLOCKFACE_UPDATE    5000
  600. X
  601. X/* Number vector :-) fonts      */
  602. X
  603. Xtypedef struct {
  604. X    double          x1;
  605. X    double          y1;
  606. X    double          x2;
  607. X    double          y2;
  608. X}               NumberSegment;
  609. X
  610. Xtypedef struct {
  611. X    NumberSegment   segment[5];
  612. X}               NumberSegmentRec;
  613. X
  614. XNumberSegmentRec num_segments[12] = {
  615. X    {
  616. X        {0, 0, 0, 2},    /* 1 */
  617. X        {0, 0, 0, 0},
  618. X        {0, 0, 0, 0},
  619. X        {0, 0, 0, 0},
  620. X        {0, 0, 0, 0}
  621. X    },
  622. X    {
  623. X        {0, 0, 0, 2},    /* 2 */
  624. X        {1, 0, 1, 2},
  625. X        {0, 0, 0, 0},
  626. X        {0, 0, 0, 0},
  627. X        {0, 0, 0, 0}
  628. X    },
  629. X    {
  630. X        {0, 0, 0, 2},    /* 3 */
  631. X        {1, 0, 1, 2},
  632. X        {2, 0, 2, 2},
  633. X        {0, 0, 0, 0},
  634. X        {0, 0, 0, 0}
  635. X    },
  636. X    {
  637. X        {0, 0, 0, 2},    /* 4 */
  638. X        {1, 0, 1.5, 2},
  639. X        {1.5, 2, 2, 0},
  640. X        {0, 0, 0, 0},
  641. X        {0, 0, 0, 0}
  642. X    },
  643. X    {
  644. X        {0, 0, 0.5, 2},    /* 5 */
  645. X        {0.5, 2, 1, 0},
  646. X        {0, 0, 0, 0},
  647. X        {0, 0, 0, 0},
  648. X        {0, 0, 0, 0}
  649. X    },
  650. X    {
  651. X        {0, 0, 0.5, 2},    /* 6 */
  652. X        {0.5, 2, 1, 0},
  653. X        {2, 0, 2, 2},
  654. X        {0, 0, 0, 0},
  655. X        {0, 0, 0, 0}
  656. X    },
  657. X    {
  658. X        {0, 0, 0.5, 2},    /* 7 */
  659. X        {0.5, 2, 1, 0},
  660. X        {2, 0, 2, 2},
  661. X        {3, 0, 3, 2},
  662. X        {0, 0, 0, 0}
  663. X    },
  664. X    {
  665. X        {0, 0, 0.5, 2},    /* 8 */
  666. X        {0.5, 2, 1, 0},
  667. X        {2, 0, 2, 2},
  668. X        {3, 0, 3, 2},
  669. X        {4, 0, 4, 2}
  670. X    },
  671. X    {
  672. X        {0, 0, 0, 2},    /* 9 */
  673. X        {1, 0, 2, 2},
  674. X        {2, 0, 1, 2},
  675. X        {0, 0, 0, 0},
  676. X        {0, 0, 0, 0}
  677. X    },
  678. X    {
  679. X        {0, 0, 1, 2},    /* 10 */
  680. X        {0, 2, 1, 0},
  681. X        {0, 0, 0, 0},
  682. X        {0, 0, 0, 0},
  683. X        {0, 0, 0, 0}
  684. X    },
  685. X    {
  686. X        {0, 0, 1, 2},    /* 11 */
  687. X        {0, 2, 1, 0},
  688. X        {2, 0, 2, 2},
  689. X        {0, 0, 0, 0},
  690. X        {0, 0, 0, 0}
  691. X    },
  692. X    {
  693. X        {0, 0, 1, 2},    /* 12 */
  694. X        {0, 2, 1, 0},
  695. X        {2, 0, 2, 2},
  696. X        {3, 0, 3, 2},
  697. X        {0, 0, 0, 0}
  698. X    }
  699. X};
  700. X
  701. X/* Resource for Clock Widget     */
  702. X
  703. Xstatic XrmOptionDescRec options[] = {
  704. X    {"-chime", "*clock.chime", XrmoptionNoArg, "TRUE"},
  705. X    {"-hd", "*clock.hands", XrmoptionSepArg, NULL},
  706. X    {"-hands", "*clock.hands", XrmoptionSepArg, NULL},
  707. X    {"-hl", "*clock.highlight", XrmoptionSepArg, NULL},
  708. X    {"-highlight", "*clock.highlight", XrmoptionSepArg, NULL},
  709. X    {"-update", "*clock.update", XrmoptionSepArg, NULL},
  710. X    {"-padding", "*clock.padding", XrmoptionSepArg, NULL},
  711. X    {"-d", "*clock.analog", XrmoptionNoArg, "FALSE"},
  712. X    {"-digital", "*clock.analog", XrmoptionNoArg, "FALSE"},
  713. X    {"-analog", "*clock.analog", XrmoptionNoArg, "TRUE"},
  714. X};
  715. END_OF_FILE
  716. if test 2714 -ne `wc -c <'xpclock.h'`; then
  717.     echo shar: \"'xpclock.h'\" unpacked with wrong size!
  718. fi
  719. # end of 'xpclock.h'
  720. fi
  721. if test -f 'xpclock.icon' -a "${1}" != "-c" ; then 
  722.   echo shar: Will not clobber existing file \"'xpclock.icon'\"
  723. else
  724. echo shar: Extracting \"'xpclock.icon'\" \(2003 characters\)
  725. sed "s/^X//" >'xpclock.icon' <<'END_OF_FILE'
  726. X/*
  727. X*    SCCS ID : @(#)xpclock.icon    1.1 10/25/89
  728. X*
  729. X*   xpclock.icon - icon bitmap data for xpclock
  730. X* 
  731. X*   Author: Kazuhiko Shutoh, 1989.
  732. X*
  733. X*   Permission to use, copy, modify and distribute without charge this
  734. X*   software, documentation, images, etc. is granted, provided that this 
  735. X*   comment and the author's name is retained.  The author assumes no 
  736. X*   responsibility for lost sleep as a consequence of use of this software.
  737. X*
  738. X*   Send any comments, bug reports, etc. to: shutoh@isl.yamaha.co.jp or, 
  739. X*   for oversea: shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net  
  740. X*                              
  741. X*/
  742. X
  743. X
  744. X#define xpclock_icon_width 31
  745. X#define xpclock_icon_height 52
  746. Xstatic char xpclock_icon_bits[] = {
  747. X   0xff, 0xff, 0xff, 0x7f, 0x01, 0x00, 0x00, 0x40, 0xfd, 0xff, 0xff, 0x5f,
  748. X   0x05, 0x00, 0x00, 0x50, 0x05, 0x00, 0x00, 0x50, 0xfd, 0xff, 0xff, 0x5f,
  749. X   0x09, 0x00, 0x00, 0x48, 0x09, 0xf0, 0x07, 0x48, 0x09, 0x0c, 0x18, 0x48,
  750. X   0x09, 0x82, 0x20, 0x48, 0x09, 0x09, 0x48, 0x48, 0x89, 0x80, 0x80, 0x48,
  751. X   0x49, 0x80, 0x00, 0x49, 0x49, 0x81, 0x40, 0x49, 0x29, 0x80, 0x00, 0x4a,
  752. X   0x29, 0x80, 0x00, 0x4a, 0x29, 0x80, 0x00, 0x4a, 0xa9, 0xe0, 0xbf, 0x4a,
  753. X   0x29, 0x80, 0x00, 0x4a, 0x29, 0x80, 0x00, 0x4a, 0x29, 0x00, 0x00, 0x4a,
  754. X   0x49, 0x01, 0x40, 0x49, 0x49, 0x00, 0x00, 0x49, 0x89, 0x00, 0x80, 0x48,
  755. X   0x09, 0x09, 0x48, 0x48, 0x09, 0x82, 0x20, 0x48, 0x09, 0x0c, 0x18, 0x48,
  756. X   0x09, 0xf0, 0x07, 0x48, 0x09, 0x00, 0x00, 0x48, 0xe9, 0xff, 0xff, 0x4b,
  757. X   0x29, 0xc0, 0x00, 0x4a, 0x29, 0x60, 0x00, 0x4a, 0x29, 0x20, 0x00, 0x4a,
  758. X   0x29, 0x30, 0x00, 0x4a, 0x29, 0x10, 0x00, 0x4a, 0x29, 0x18, 0x00, 0x4a,
  759. X   0x29, 0x0e, 0x00, 0x4a, 0x29, 0x11, 0x00, 0x4a, 0xa9, 0x20, 0x00, 0x4a,
  760. X   0xa9, 0x20, 0x00, 0x4a, 0xa9, 0x20, 0x00, 0x4a, 0x29, 0x11, 0x00, 0x4a,
  761. X   0x29, 0x0e, 0x00, 0x4a, 0x29, 0x00, 0x00, 0x4a, 0xe9, 0xff, 0xff, 0x4b,
  762. X   0x09, 0x00, 0x00, 0x48, 0xfd, 0xff, 0xff, 0x5f, 0x05, 0x00, 0x00, 0x50,
  763. X   0x05, 0x00, 0x00, 0x50, 0xfd, 0xff, 0xff, 0x5f, 0x01, 0x00, 0x00, 0x40,
  764. X   0xff, 0xff, 0xff, 0x7f};
  765. END_OF_FILE
  766. if test 2003 -ne `wc -c <'xpclock.icon'`; then
  767.     echo shar: \"'xpclock.icon'\" unpacked with wrong size!
  768. fi
  769. # end of 'xpclock.icon'
  770. fi
  771. if test -f 'xpclock.man' -a "${1}" != "-c" ; then 
  772.   echo shar: Will not clobber existing file \"'xpclock.man'\"
  773. else
  774. echo shar: Extracting \"'xpclock.man'\" \(1857 characters\)
  775. sed "s/^X//" >'xpclock.man' <<'END_OF_FILE'
  776. X.TH XPCLOCK 1 "13 October 1988" "X Version 11"
  777. X.SH NAME
  778. Xxpclock - Pendulum clock for X
  779. X.SH SYNOPSIS
  780. X.B xpclock
  781. X[-\fItoolkitoption\fP ...] [-xclock-option ...] [-pupdate milliseconds] [-nopendulum]
  782. X.SH DESCRIPTION
  783. XThe
  784. X.I xpclock 
  785. Xprogram displays the animate pendulum and time in analog form.  The time is continuously
  786. Xupdated at a frequency which may be specified by the user.  This program is
  787. Xusing the Athena Clock widget.
  788. X.SH OPTIONS
  789. X.I Xpclock
  790. Xaccepts all of the standard X Toolkit and  Xclock command line options along with the 
  791. Xadditional options listed below:
  792. X.TP 8
  793. X.B \-pupdate <milliseconds>
  794. XThis option indicates that set pendulum update timeout. The default is 100 milliseconds.
  795. X.TP 8
  796. X.B \-nopendulum 
  797. XThis option indicates that turn off pendulum.
  798. X.SH X DEFAULTS
  799. XThis program uses the 
  800. X.I Clock
  801. Xwidget in the X Toolkit.  It understands all of the core resource names and
  802. Xclasses.
  803. X.PP
  804. X.SH "SEE ALSO"
  805. XX(1), xclock(1), xrdb(1), time(3C), Athena Clock widget
  806. X.SH BUGS
  807. X.I Xpclock
  808. Xbelieves the system clock.
  809. X.PP
  810. X.I Xpclock
  811. Xis CPU eater. sorry.
  812. X.PP
  813. XDigital mode (-digital) does not work. sorry. (but why?)
  814. X.SH "COPYRIGHT NOTICE"
  815. X.PP
  816. XPermission to use, copy, modify and distribute without charge this
  817. Xsoftware, documentation, images, etc. is granted, provided that this 
  818. Xcomment and the author's name is retained.  The author assumes no 
  819. Xresponsibility for lost sleep as a consequence of use of this software.
  820. X.PP
  821. XSend any comments, bug reports, etc. to: shutoh@isl.yamaha.co.jp or, 
  822. Xfor oversea: shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net  
  823. X.br
  824. XSee \fIX(1)\fP for a full statement of rights and permissions.
  825. X.SH AUTHORS
  826. X
  827. Xxclock : 
  828. X.br
  829. XTony Della Fera (MIT-Athena, DEC)
  830. X.br
  831. XDave Mankins (MIT-Athena, BBN)
  832. X.br
  833. XEd Moy (UC Berkeley)
  834. X.br
  835. Xxpclock:
  836. X.br
  837. XKazuhiko Shutoh
  838. Xshutoh@isl.yamaha.co.jp or, 
  839. Xfor oversea: shutoh%isl.yamaha.co.jp%kddlab@uunet.uu.net  
  840. X
  841. END_OF_FILE
  842. if test 1857 -ne `wc -c <'xpclock.man'`; then
  843.     echo shar: \"'xpclock.man'\" unpacked with wrong size!
  844. fi
  845. chmod +x 'xpclock.man'
  846. # end of 'xpclock.man'
  847. fi
  848. echo shar: End of shell archive.
  849. exit 0
  850.